/*
 * Copyright (c)  2017
 * All rights reserved.
 * ProductInfo.java 2017-09-13 下午7:47
 */

package com.ueboot.weishop.entity.setting;

import com.ueboot.weishop.entity.IDEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;


/**
 * 描述:商品类别表
 *
 * @author yangkui create on 2017-09-13 下午7:47.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_BRAND")
public class BrandEntity extends IDEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_BRAND")
    @GenericGenerator(name = "WS_BRAND", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_BRAND"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled") })
    @Column(name = "ID",columnDefinition = "INT(20) COMMENT 'id主键'",length = 20)
    private Long id;

    /**
     * 品牌名称
     */
    @Column(name = "NAME",columnDefinition = "VARCHAR(200) COMMENT '商品名称'",length = 200)
    private String name;

    /**
     * 品牌代码
     */
    @Column(name = "CODE",columnDefinition = "VARCHAR(200) COMMENT '品牌代码'",length = 200)
    private String code;

    /**
     * 品牌描述
     */
    @Column(name = "REMARK",columnDefinition = "VARCHAR(2000) COMMENT '品牌描述'",length = 2000)
    private String remark;
    /**
     * 所属分类，每个分类下可以有多个相同的品牌。
     * 发布商品的时候先选择分类，再选择品牌
     */
    @ManyToOne
    @JoinColumn(name="CATEGORY_ID",columnDefinition = "INT(20) COMMENT '所属分类，每个分类下可以有多个相同的品牌。'")
    private CategoryEntity category;
}